from selenium import webdriver
from unittest import TestCase
from ddt import ddt,data,unpack
from 测试数据.Testnum1 import Testnumber
from 测试数据.ChangeDatabase import ChangeDatabase
from 页面对象.LoginPage import LoginPage



from 页面对象.BuyFinancePage import BuyFinancePage

@ddt
class TestBuyFinanceLin(TestCase):
    # @data(*Testnumber().excel2_1)
    # @unpack
    # def testBuyFinanceSuccess(self, username, password, pay_pwd, expect):
    #     driver = webdriver.Chrome()
    #     driver.implicitly_wait(10)
    #     driver.maximize_window()
    #     driver.get("http://192.168.139.128:90/")
    #
    #     login = LoginPage(driver)
    #     login.login(username, password)
    #
    #     buy = BuyFinancePage(driver)
    #     result1 = buy.buyFinanceLin(pay_pwd)
    #
    #     driver.quit()
    #     self.assertEqual(expect, result1)

    # @data(*Testnumber().excel2_2)
    # @unpack
    # def testBuyFinanceSuccess(self, username, password, pay_pwd, expect):
    #     driver = webdriver.Chrome()
    #     driver.implicitly_wait(10)
    #     driver.maximize_window()
    #     driver.get("http://192.168.139.128:90/")
    #
    #     login = LoginPage(driver)
    #     login.login(username, password)
    #
    #     buy = BuyFinancePage(driver)
    #     result1 = buy.buyFinanceLin2(pay_pwd)
    #
    #     driver.quit()
    #     self.assertEqual(expect, result1)
    # @data(*Testnumber().excel2_3)
    # @unpack
    # def testBuyFinanceSuccess(self, username, password, pay_pwd, expect):
    #     driver = webdriver.Chrome()
    #     driver.implicitly_wait(10)
    #     driver.maximize_window()
    #     driver.get("http://192.168.139.128:90/")
    #
    #     login = LoginPage(driver)
    #     login.login(username, password)
    #
    #     buy = BuyFinancePage(driver)
    #     result1 = buy.buyFinanceLin3(pay_pwd)
    #
    #     driver.quit()
    #     self.assertEqual(expect, result1)
    @data(*Testnumber().excel2_4)
    @unpack
    def testBuyFinanceSuccess4(self, username, password, pay_pwd, expect):
        driver = webdriver.Chrome()
        driver.implicitly_wait(10)
        driver.maximize_window()
        driver.get("http://192.168.139.128:90/")

        login = LoginPage(driver)
        login.login(username, password)

        buy = BuyFinancePage(driver)
        result1 = buy.buyFinanceLin4(pay_pwd)

        driver.quit()
        self.assertEqual(expect, result1)
